//
//  YFMenuViewCell.m
//  SquashSpark
//
//  Created by Coollang on 2017/10/26.
//  Copyright © 2017年 Coollang-YF. All rights reserved.
//

#import "YFMenuViewCell.h"
#import "YFMenuModel.h"

@interface YFMenuViewCell()
@property (nonatomic, weak)IBOutlet UIView *bottomLine;
@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;
@property (weak, nonatomic) IBOutlet UILabel *moduleNameLabel;
@property (weak, nonatomic) IBOutlet UIImageView *selectTwigImageView;

@property (nonatomic, strong) YFMenuModel *menuModel;

@end

@implementation YFMenuViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
}
- (void)layoutSubviews {
    [super layoutSubviews];
}
- (void)configerMenuViewCellWithModel:(YFMenuModel *)menuModel {
    self.menuModel = menuModel;
    self.iconImageView.image = [UIImage imageNamed:menuModel.unSelectimageName];
    self.moduleNameLabel.text = menuModel.moduleName;
}

- (void)updateUIWithSelect:(BOOL)select {
    self.selectTwigImageView.hidden = !select;
    if (select) {
        self.iconImageView.image = [UIImage imageNamed:_menuModel.selectImageName];
        self.moduleNameLabel.textColor = kYellowGreenColor;
        self.backgroundColor = [UIColor colorWithHex:0x051727];
    }else {
        self.iconImageView.image = [UIImage imageNamed:_menuModel.unSelectimageName];
        self.moduleNameLabel.textColor = kTLightGray999;
        self.backgroundColor = [UIColor clearColor];
    }
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    // Configure the view for the selected state
    [self updateUIWithSelect:selected];
}

@end
